package com.thinkTank.oa.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkTank.oa.base.BaseServiceImpl;
import com.thinkTank.oa.dao.PermissionMapper;
import com.thinkTank.oa.dao.RoleMapper;
import com.thinkTank.oa.dao.UserMapper;
import com.thinkTank.oa.entity.Permission;
import com.thinkTank.oa.entity.Role;
import com.thinkTank.oa.service.PermissionService;
import com.thinkTank.oa.service.RoleService;
@Transactional
@Service("permissionService")
public class PermissionServiceImpl extends BaseServiceImpl<Permission> implements  PermissionService  {
	public PermissionMapper getPermissionMapper() {
		return (PermissionMapper)super.getBaseMapper();
	}
	@Autowired
	private RoleMapper roleMapper;
	
	@Autowired	
	public void setPermissionMapper(PermissionMapper permissionMapper) {
		super.setBaseMapper(permissionMapper);
	}
	
	public List<Permission> findPermissionByMenu(){
		return this.getPermissionMapper().findPermissionByMenu();
	}
	public Permission findPermissionByUrl(String url){
		return this.getPermissionMapper().findPermissionByUrl(url);
	}
	@Override
	public List<Permission> queryAllMenu() {
		
		return this.getPermissionMapper().queryAllMenu();
	}
	@Override
	public List<Permission> queryAllPermission() {
		
		return this.getPermissionMapper().queryAllPermission();
	}

	@Override
	public List<Permission> queryAllUserByPerm(String userId) {
		return this.getPermissionMapper().queryAllUserByPerm(userId);
		
	}

	@Override
	public List<Permission> findPermissionByRoleId(Integer roleId) {
		
		return this.getPermissionMapper().findPermissionByRoleId( roleId);
	}

	
}
